package com.panda.system.controller;


import com.panda.common.annotation.Log;
import com.panda.common.core.controller.BaseController;
import com.panda.common.core.domain.AjaxResult;
import com.panda.common.core.page.TableDataInfo;
import com.panda.common.enums.BusinessType;
import com.panda.common.utils.poi.ExcelUtil;
import com.panda.system.domain.PandaTaskDetail;
import com.panda.system.service.IPandaTaskDetailService;
import io.swagger.annotations.Api;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@Api("报表管理")
@RestController
@RequestMapping("/system/report")
public class RepostController extends BaseController {

    @Autowired
    private IPandaTaskDetailService pandaTaskDetailService;

    /**
     * 查询任务完成明细列表
     */
    @GetMapping("/rebatesrepost")
    public TableDataInfo list(PandaTaskDetail pandaTaskDetail)
    {
        startPage();
        List<PandaTaskDetail> list = pandaTaskDetailService.selectPandaTaskDetailReport(pandaTaskDetail);
        return getDataTable(list);
    }

    /**
     * 导出任务完成明细列表
     */
    @Log(title = "任务完成明细", businessType = BusinessType.EXPORT)
    @GetMapping("/exportrebatesrepost")
    public AjaxResult export(PandaTaskDetail pandaTaskDetail)
    {
        List<PandaTaskDetail> list = pandaTaskDetailService.selectPandaTaskDetailReport(pandaTaskDetail);
        ExcelUtil<PandaTaskDetail> util = new ExcelUtil<PandaTaskDetail>(PandaTaskDetail.class);
        return util.exportExcel(list, "detail");
    }
}
